package com.sort;

public class AllSort {
    public static void main(String[] args) {
        int[] arr0 = {3,2,1,5,7,34,57,100,98,45,67,82};
        int[] arr1 = {3,2,1,5,7,34,57,100,98,45,67,82};
        int[] arr2 = {3,2,1,5,7,34,57,100,98,45,67,82};
        int[] arr3 = {3,2,1,5,7,34,57,100,98,45,67,82};
        int[] arr4 = {3,2,1,5,7,34,57,100,98,45,67,82};
        int[] arr5 = {3,2,1,5,7,34,57,100,98,45,67,82};
        int[] arr6 = {3,2,1,5,7,34,57,100,98,45,67,82};
        int[] arr7 = {3,2,1,5,7,34,57,100,98,45,67,82};
        int[] arr8 = {3,2,1,5,7,34,57,100,98,45,67,82};
        int[] arr9 = {3,2,1,5,7,34,57,100,98,45,67,82};

        //选择排序
        SelectionSort selectionSort = new SelectionSort();
        selectionSort.sort(arr0);
        System.out.println("选择排序：");
        printArr(arr0);
        //冒泡排序
        BubbleSort bubbleSort = new BubbleSort();
        bubbleSort.sort(arr1);
        System.out.println("冒泡排序：");
        printArr(arr1);
        //插入排序
        InsertionSort insertionSort = new InsertionSort();
        insertionSort.sort(arr2);
        System.out.println("插入排序：");
        printArr(arr2);
        //希尔排序
        ShellSort shellSort = new ShellSort();
        shellSort.sort(arr3);
        System.out.println("希尔排序：");
        printArr(arr3);
        //归并排序
        MergeSort mergeSort = new MergeSort();
        mergeSort.sort(arr4,0,arr4.length-1);
        System.out.println("归并排序：");
        printArr(arr4);
        //堆排序
        HeapSort heapSort = new HeapSort();
        heapSort.sort(arr5);
        System.out.println("堆排序：");
        printArr(arr5);
        //快速排序
        QuickSort quickSort = new QuickSort();
        quickSort.sort(arr6,0,arr6.length-1);
        System.out.println("快速排序：");
        printArr(arr6);
        //计数排序
        CountingSort countingSort = new CountingSort();
        countingSort.sort(arr7,countingSort.getMax(arr7));
        System.out.println("计数排序：");
        printArr(arr7);
        //桶排序
        BucketSort bucketSort = new BucketSort();
        bubbleSort.sort(arr8);
        System.out.println("桶排序：");
        printArr(arr8);
        //基数排序
        RadixSort radixSort = new RadixSort();
        radixSort.sort(arr9);
        System.out.println("基数排序：");
        printArr(arr9);
    }
    public static void printArr(int[] arr){
        for(int i : arr){
            System.out.print(i+" ");
        }
        System.out.println();
    }
}
